Skip to content

refactor(ios): move rejectPromiseWithMessage helper into RNMLKit core#260

Merged
trevor-coleman merged 3 commits into
mainfrom
claude/wonderful-cori-gWWx4
Jun 4, 2026
Merged

refactor(ios): move rejectPromiseWithMessage helper into RNMLKit core#260
trevor-coleman merged 3 commits into
mainfrom
claude/wonderful-cori-gWWx4

Conversation

@trevor-coleman

Copy link
Copy Markdown
Collaborator

Summary

Closes #254.

The rejectPromiseWithMessage Swift helper was duplicated verbatim in three modules (face-detection, object-detection, and image-labeling). This moves it into RNMLKitCore as a public function so it can be shared across modules — including the upcoming barcode scanning work mentioned in the issue — rather than being copied into each one.

Changes

  • Added modules/react-native-mlkit-core/ios/RNMLKitPromise.swift defining a public func rejectPromiseWithMessage(promise:message:domain:).
  • Removed the three duplicate local definitions in:
    • react-native-mlkit-face-detection
    • react-native-mlkit-object-detection
    • react-native-mlkit-image-labeling
  • Added import RNMLKitCore to the object-detection and image-labeling module files (face-detection already imported it). All three modules already declare RNMLKitCore as a podspec dependency.
  • Documented the shared helper in the core package README.
  • Added a changeset (core minor — new public API; the three consumers patch).

Notes

The function body is unchanged from the original, so behavior is identical. This is an iOS-only change; nothing was needed on the Kotlin/Android side.

https://claude.ai/code/session_01SjeGje7R2MyoYDFjEVR3qt


Generated by Claude Code

The rejectPromiseWithMessage Swift helper was duplicated verbatim in the
face-detection, object-detection, and image-labeling modules. Move it to
RNMLKitCore as a public function so it can be shared across modules
(including the upcoming barcode scanning module) instead of being copied
into each one.

Closes #254
@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 309434a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@infinitered/react-native-mlkit-core Minor
@infinitered/react-native-mlkit-face-detection Patch
@infinitered/react-native-mlkit-object-detection Patch
@infinitered/react-native-mlkit-image-labeling Patch
@infinitered/react-native-mlkit-document-scanner Patch
@infinitered/react-native-mlkit-text-recognition Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@trevor-coleman trevor-coleman merged commit 6f0d469 into main Jun 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Move rejectPromiseWithMessage to RNMLKit core

2 participants